package com.fang.algorithm.common;

/**
 * @author fanglingxiao
 * @version 1.0
 * @description TODO
 * @date 2022/1/5 3:47 下午
 **/
public class SwapUtils {
    public static void arrSwap(int[] arr, int i, int j) {
        int temp = arr[i];
        arr[i] = arr[j];
        arr[j] = temp;
    }

    public static void arrSwap2(int[] arr, int i, int j) {
        if (i == j) {
            return;
        }
        arr[i] = arr[i] ^ arr[j];
        arr[j] = arr[i] ^ arr[j];
        arr[i] = arr[i] ^ arr[j];
    }
}
